﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
 
using LapvBussiness;
using LapvWebComponent;

namespace LapvRSS
{
    public partial class Detail : System.Web.UI.Page
    {
        public string genhtml = "";
        public string Title_ = "";
        public DateTime Date = DateTime.Now;
        public string Des = "";
        public string Img = "";
        public string titlepage = "";
        public string domain = ConfigLapv.Instance.DomainAdmin;
        public string tid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            
            int id = -1;
            
            if (Request.Params["id"] != null)
                int.TryParse(Request.Params["id"].ToString(), out id);
            
            
            
            try
            {
                using (lapvwebEntities db = new lapvwebEntities())
                {
                    news n = null;

                    if (id > 0)
                    {
                        n = db.news.Include("news_category").Where(en => en.id == id).FirstOrDefault();
                        titlepage = n.news_category.name;
                        tid = n.news_category.id.ToString();
                        if (n != null)
                        {
                            Title_ = n.title;
                            Img = n.image;
                            Des = n.content;
                            Date = n.datecreate;
                        }
                    } 
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
